home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-08-25 | 3.4 KB | 92 lines | [TEXT/CWIE] |
-
-
- #include <LApplication.h>
- #include <LGrowZone.h>
- #include <LWindow.h>
- #include <LGroupBox.h>
- #include <UMemoryMgr.h>
- #include <UDrawingState.h>
- #include <URegistrar.h>
- #include <UReanimator.h>
-
- #include <LEditField.h>
- #include <LTabGroup.h>
- #include <LCaption.h>
- #include <LStdControl.h>
- #include <LDialogBox.h>
- #include <UModalDialogs.h>
- #include <PP_Messages.h>
-
- #include "CSAMLauncherEditorWindow.h"
- #include "LStyledTextEdit.h"
- #include "EditorUtilities.h"
- #include "NewWithFree.h"
-
- // ===========================================================================
- // • Main Program
- // ===========================================================================
-
- extern "C" SInt32 main( EditorLibProcParamBlockPtr inEditorLibProcParamBlockPtr )
- {
-
- // Assume the worst
- SInt32 result = -1;
-
- try
- {
- // Set Debugging options
- SetDebugThrow_(debugAction_Alert);
- SetDebugSignal_(debugAction_Alert);
-
-
- // Register the shell's QuickDraw globals
- UQDGlobals::SetQDGlobals( inEditorLibProcParamBlockPtr->fQDGlobals );
-
-
- // Setup the menu bar, since the dialog handler expects to enable/disable the Edit menu items.
- //
- // ••• Make sure to use the LMenuBar.cp provided in the SDK, which has smarter LMenuBar::LMenuBar(…)
- // ••• and LMenuBar::~LMenuBar() routines to support menu handling from within drop-in libraries.
- //
- LMenuBar* theMenuBar = new LMenuBar( MBAR_Initial );
-
-
- // Register some LPane classes.
- URegistrar::RegisterClass(LStyledTextEdit::class_ID,(ClassCreatorFunc) LStyledTextEdit::CreateStyledTextEditStream );
- URegistrar::RegisterClass(LScroller::class_ID, (ClassCreatorFunc) LScroller::CreateScrollerStream );
- URegistrar::RegisterClass(LEditField::class_ID, (ClassCreatorFunc) LEditField::CreateEditFieldStream);
- URegistrar::RegisterClass(LTabGroup::class_ID, (ClassCreatorFunc) LTabGroup::CreateTabGroupStream);
- URegistrar::RegisterClass(LRadioGroup::class_ID, (ClassCreatorFunc) LRadioGroup::CreateRadioGroupStream );
- URegistrar::RegisterClass(LGroupBox::class_ID, (ClassCreatorFunc) LGroupBox::CreateGroupBoxStream );
- URegistrar::RegisterClass(LCaption::class_ID, (ClassCreatorFunc) LCaption::CreateCaptionStream);
- URegistrar::RegisterClass(LStdRadioButton::class_ID,(ClassCreatorFunc) LStdRadioButton::CreateStdRadioButtonStream );
- URegistrar::RegisterClass(LStdCheckBox::class_ID, (ClassCreatorFunc) LStdCheckBox::CreateStdCheckBoxStream);
- URegistrar::RegisterClass(LStdPopupMenu::class_ID, (ClassCreatorFunc) LStdPopupMenu::CreateStdPopupMenuStream);
- URegistrar::RegisterClass(LStdButton::class_ID, (ClassCreatorFunc) LStdButton::CreateStdButtonStream);
- URegistrar::RegisterClass(LDialogBox::class_ID, (ClassCreatorFunc) LDialogBox::CreateDialogBoxStream);
- URegistrar::RegisterClass(LWindow::class_ID, (ClassCreatorFunc) LWindow::CreateWindowStream);
-
-
- // Open the editor window and start editing
- if( inEditorLibProcParamBlockPtr->fFileRefNum != -1 )
- {
- CEditorWindow* theEditorWindow = new CEditorWindow( inEditorLibProcParamBlockPtr->fFileRefNum, inEditorLibProcParamBlockPtr->fPreferenceRsrcID, inEditorLibProcParamBlockPtr->fResListRsrcID );
- result = theEditorWindow->DoEdit();
- delete theEditorWindow;
- }
-
- delete theMenuBar;
- }
- catch( OSErr theErr )
- {
- ;
- }
-
- // Disposes of memory pools allocated with new operator in order to prevent leaks.
- FreeAllCplusMemory();
-
- // Return values: 0: Changes accepted, 1: Canceled (changes discarded), 2: Removed, < 0: Internal error (changes discarded)
- return result;
- }
-
-